package com.sunjq.multithread.createconsumer;

public class Consumer extends AbstractCreatorAndConsumer implements Runnable {

	// private void consume() {
	// wh.outCome();
	// }

	public void consume() {
		synchronized (wh) {
//			while (true) {
				if (wh.getStatus().equals("created")) {
					System.out
							.println("before consume => " + wh.getOutcomeId());
					wh.outCome();
					wh.setStatus("consumed");
					wh.notify();
					System.out.println("Consume notify wh");
					System.out.println("Consume this => " + wh.getOutcomeId());
				} else {
					try {
						System.out.println("Consume wait wh");
						wh.wait();

					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
			}
	
//		}

	}

	public void run() {
		this.consume();

	}
}
